package com.nhc.model;

import java.text.DecimalFormat;

import zuo.biao.library.base.BaseModel;

public class CompassDatainfo extends BaseModel {

    private static final long serialVersionUID = 1L;

    private float currentvel; //当前速度 km/h
    private String dirname; //航线
    private int azimuth; //Azimuth
    private String realdirname; //当前目标方向

    /**
     * 默认构造方法，JSON等解析时必须要有
     */
    public CompassDatainfo() {
        //default
        reset();
    }

    public CompassDatainfo(long id) {
        this();
        this.id = id;
        reset();
    }

    public void reset() {
        currentvel = 0;
        dirname = "-----";
        azimuth = -1;
        realdirname = "-----";
    }

    public String getCurrentvelstr() {
        return new DecimalFormat("00.0").format(currentvel);
    }

    public String getAzimuthstr() {
        if (azimuth < 0) {
            return "- - - - -";
        }
        return azimuth + "°";
    }

    public float getCurrentvel() {
        return currentvel;
    }

    public void setCurrentvel(float currentvel) {
        this.currentvel = currentvel;
    }

    public String getDirname() {
        return dirname;
    }

    public void setDirname(String dirname) {
        this.dirname = dirname;
    }

    public int getAzimuth() {
        return azimuth;
    }

    public void setAzimuth(int azimuth) {
        this.azimuth = azimuth;
    }

    public String getRealdirname() {
        return realdirname;
    }

    public void setRealdirname(String realdirname) {
        this.realdirname = realdirname;
    }

    /**
     * 以下getter和setter可以自动生成
     * <br>  eclipse: 右键菜单 > Source > Generate Getters and Setters
     * <br>  android studio: 右键菜单 > Generate > Getter and Setter
     */


    @Override
    protected boolean isCorrect() {//根据自己的需求决定，也可以直接 return true
        return id > 0;// && StringUtil.isNotEmpty(phone, true);
    }

}
